#!/usr/bin/perl

# ---------- Init variables -------
#my $version = "0.0001";
# ---------- external readable parameters -------
## Functions
##-------------------------------------------------------
#
# stict syntax checking.
use strict;
#use CGI qw(param);
use SIM_cgi;
use SIM_settings;

#BEGIN { $Exporter::Verbose=1 }

# Startupscript translater
my $module = $ARGV[0];
my $tool = $ARGV[1];
my $option1 = $ARGV[2];
my $option2 = $ARGV[3];
my $option3 = $ARGV[4];
my $option4 = $ARGV[5];
my $option5 = $ARGV[6];



my $backHeader="black";
my $httpUser = $ENV{'REMOTE_USER'};
my $httpReF = $ENV{'HTTP_REFERER'};
my $httpScriptName = $ENV{'SCRIPT_NAME'};


sub printHead {
  my $dispHead = "@_[0]";
  print("<FONT COLOR=#666666>");
  chdir($SIMparam{'SIMpluginsDir'});
  my @vendorPlugins = <vendor-*>;
  my $separator = "";
  foreach my $plugin (@vendorPlugins) {
#   print(" plugin=$plugin ");
    my ( $baseName, $extension ) = split('\.', $plugin);
    my $vendor = substr($baseName, 7);
    printEntry2($vendor, "plugin for $vendor", "$module+$tool", "vendor+$vendor", "", "line", "$separator", "");
    $separator = "|";
  }
  print("
        </FONT>
	</TD></TR>
	</TABLE>
        ");
}

printHead;
if ( $tool ne "none" ) {
  if ( -x "$SIMparam{'SIMpluginsDir'}/vendor-$tool.pl" ) {
    system(" $SIMparam{'SIMpluginsDir'}/vendor-$tool.pl $module $tool $option1 $option2 $option3 $option4 $option5 2>&1 ");
  }
} else {
  print("<CENTER><H2>Please select an tool from the list above.</H2>");
}

